<template>
    <el-date-picker v-model="data[$attrs.prop]" v-bind="{ ...config[$attrs.type], ...$attrs }" />
</template>
<script lang="ts">
export const shortcuts = () => {
    const end = new Date();
    return [
        {
            text: '近一周',
            value: () => {
                const start = new Date();
                start.setDate(start.getDate() - 7);
                return [start, end];
            }
        },
        {
            text: '近一月',
            value: () => {
                const start = new Date();
                start.setMonth(start.getMonth() - 1);
                return [start, end];
            }
        },
        {
            text: '近三月',
            value: () => {
                const start = new Date();
                start.setMonth(start.getMonth() - 3);
                return [start, end];
            }
        }
    ];
};
</script>
<script setup lang="ts">
defineProps({
    data: {
        type: Object,
        required: true,
        default: () => ({})
    }
});
const config = {
    datetime: {},
    datetimerange: {},
    daterange: {},
    date: {},
    year: {},
    years: {},
    month: {},
    dates: {},
    week: {},
    monthrange: {}
};
</script>

<style lang="scss" scoped></style>
